package cn.fl.spl.transform;

import java.util.ArrayList;
import java.util.List;

import cn.cmm.base.framework.utils.CollectionUtils;
import cn.fl.spl.vo.RegAddrRelInfoViewVO;
import fl.spl.facade.view.dto.RegAddrRelInfoViewDTO;

public class RegAddrRelInfoViewVOTransform {
	/**
	 * VO ת  DTO
	 * @param vo RegAddrRelInfoView
	 * @return RegAddrRelInfoViewDTO
	 */
	public static RegAddrRelInfoViewDTO toDTO(RegAddrRelInfoViewVO vo) {
		RegAddrRelInfoViewDTO  dto = null;
		if (vo != null) {
			dto = new RegAddrRelInfoViewDTO();
			dto.setId(vo.getId());
			dto.setRelTypCd(vo.getRelTypCd());
			dto.setAudStsCd(vo.getAudStsCd());
			dto.setName(vo.getName());
			dto.setPropTypCd(vo.getPropTypCd());
			dto.setAddr(vo.getAddr());
		}
		return dto;
	}

	/**
	 * DTO ת  VO
	 * @param dto RegAddrRelInfoViewDTO
	 * @return RegAddrRelInfoView
	 */
	public static RegAddrRelInfoViewVO toVO(RegAddrRelInfoViewDTO dto) {
		RegAddrRelInfoViewVO vo = null;
		if (dto != null) {
			vo = new RegAddrRelInfoViewVO();
			vo.setId(dto.getId());
			vo.setRelTypCd(dto.getRelTypCd());
			vo.setAudStsCd(dto.getAudStsCd());
			vo.setName(dto.getName());
			vo.setPropTypCd(dto.getPropTypCd());
			vo.setAddr(dto.getAddr());
		}
		return vo;
	}

	/**
	 *	voList转dtoList
	 * @param list List<RegAddrRelInfoViewVO>
	 * @return List<RegAddrRelInfoViewDTO>
	 * @return
	 */
	public static List<RegAddrRelInfoViewDTO> toDTOList(List<RegAddrRelInfoViewVO> list) {
		List<RegAddrRelInfoViewDTO>  dtoList = new ArrayList<RegAddrRelInfoViewDTO>();
		if(CollectionUtils.isNotEmpty(list)){
			for (RegAddrRelInfoViewVO vo : list) {
				dtoList.add(toDTO(vo));
			}
		}
		return dtoList;
	}
	
	/**
	 *	dtoList转voList
	 * @param list List<RegAddrRelInfoViewDTO>
	 * @return List<RegAddrRelInfoViewVO>
	 * @return
	 */
	public static List<RegAddrRelInfoViewVO> toVOList(List<RegAddrRelInfoViewDTO> list) {
		List<RegAddrRelInfoViewVO>  voList = new ArrayList<RegAddrRelInfoViewVO>();
		if(CollectionUtils.isNotEmpty(list)){
			for (RegAddrRelInfoViewDTO dto : list) {
				voList.add(toVO(dto));
			}
		}
		return voList;
	}
}
